        SUBROUTINE OpenAD_MASKER(N, M, THCK, NMSB, MASK, COUNT)
        use OAD_active
        INTEGER N
        INTEGER M
        REAL THCK(1 : N, 1 : M)
        REAL NMSB(1 : N, 1 : M)
        INTEGER MASK(1 : N, 1 : M)
        INTEGER COUNT
C
C       **** Local Variables and Functions ****
C
        INTEGER I
        INTEGER J
C
C       **** Statements ****
C
        COUNT = 1
        MASK(1 : N, 1 : M) = 0
        DO I = 2, (N +(-1)), 1
          DO J = 2, (M +(-1)), 1
             if (double_tape_size.lt.double_tape_pointer) then
            allocate(double_tmp_tape(double_tape_size),STAT=cp_loop_vari
     +able_1)
            if (cp_loop_variable_1.gt.0) then
            print *,'allocation failed with',cp_loop_variable_1
            stop
            end if
            double_tmp_tape = double_tape
            deallocate(double_tape)
            allocate(double_tape(double_tape_size*2))
            print *,"DT+"
            double_tape(1:double_tape_size) = double_tmp_tape
            deallocate(double_tmp_tape)
            double_tape_size = double_tape_size*2
            end if
            double_tape(double_tape_pointer) = NMSB(I,J)
            double_tape_pointer = double_tape_pointer+1
          END DO
        END DO
        END SUBROUTINE
